import pandas as pd
import subprocess

from tqdm import tqdm

# 读取数据 https://hugovk.github.io/top-pypi-packages/
data = pd.read_csv("top-pypi-packages.csv")
data = data.loc[data["project"].apply(lambda x: isinstance(x, str)), "project"].values.tolist()
with open("requirements.txt", "w") as f:
    f.write("\n".join(data))

# command = "pip download -i https://mirrors.aliyun.com/pypi/simple/ --python-version 313 --only-binary=:all: -d ./packages -r requirements.txt"
# 执行命令
# result = subprocess.run(command, shell=True)
# 可以检查 result.returncode 来判断命令是否成功执行

# pypi-server run -p 8080 -P .htpasswd -a update,download E:\python_packages
